import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import Login from '../views/Login/login.vue'
import Home from '../views/Home.vue'
import Contract from '../views/Sale/Contract.vue'
import Goods from '../views/Goods/Goods.vue'
import Client from '../views/Client/Client.vue'
import Salesman from '../views/Salesman/Salesman.vue'
import InputList from '../views/InputList/InputList.vue'
import PurchasingList from '../views/PurchasingList/PurchasingList.vue'
import DispatchList from '../views/DispatchList/DispatchList.vue'
import User from '../views/User/User.vue'
import Main from '../views/Main/Main.vue'


const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/home/main',
    children: [
      {
        path: 'main',
        component: Main
      },
      {
        path: 'contract',
        component: Contract
      },
      {
        path: 'goods',
        component: Goods
      },
      {
        path: 'client',
        component: Client
      },
      {
        path: 'salesman',
        component: Salesman
      },
      {
        path: 'input-list',
        component: InputList
      },
      {
        path: 'dispatch-list',
        component: DispatchList
      },
      {
        path: 'purchasing-list',
        component: PurchasingList
      },
      {
        path: 'user',
        component: User
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
